import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader"
// 导入gui
// import gui from '@/three/Gui'
import scene from '@/three/Scene'
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader'
import eventbus from "@/until/eventbus"

export default class fmodel {
    constructor() {
        this.loader = new GLTFLoader()
        const dracoLoader = new DRACOLoader()
        dracoLoader.setDecoderPath('./draco/')
        this.loader.setDRACOLoader(dracoLoader)
        this.loader.load(
            "./model/piaofu.glb",
            (gltf) => {
                this.Ascene = gltf.scene
                // console.log(this.Ascene);
                this.Ascene.children[0].position.x = 0
                this.Ascene.children[0].position.y = 0
                this.Ascene.children[0].position.z = 0
                scene.add(this.Ascene)
                eventbus.emit('turn')
                // gui.add(gltf.scene.children[0].position, "x").min(0).max(10).step(0.01)
                // gui.add(gltf.scene.children[0].position, "y").min(0).max(10).step(0.01)
                // gui.add(gltf.scene.children[0].position, "z").min(0).max(10).step(0.01)
            }
        )
    }
}
